﻿//cesium 三维的影响结构数据 -->
//健康卫生

var chartcsjs = (function () {
    // 初始化
    function chartcsjs() {
        // 属性

    };

    ////
    chartcsjs.prototype.init = function (options) {
        this.etsl();
        this.wsjg();
    }
    
    /*
    育龄妇女小孩数量
    */
    chartcsjs.prototype.etsl = function (options) {
        var datas = [[], [], []];
        var categorys = [];


        var option = {
            backgroundColor: 'rgba(0,0,0,0)',
            /* legend: {
                bottom: 20,
                textStyle: {
                    color: '#fff',
                },
                data: ['钥匙量', '有效房源量']
            },*/
            grid: {
                left: '3%',
                right: '4%',
                bottom: '10%',
                containLabel: true
            },

            tooltip: {
                show: "true",
                trigger: 'axis',
                axisPointer: {
                    // 坐标轴指示器，坐标轴触发有效
                    type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
                }
            },
            xAxis: {
                type: 'value',
                axisTick: { show: false },
                axisLine: {
                    show: false,
                    lineStyle: {
                        color: '#2B80CF',
                    }
                },
                splitLine: {
                    show: false
                },
                axisLabel: { show: false },
            },
            yAxis: [
                {
                    type: 'category',
                    axisTick: { show: false },
                    axisLine: {
                        show: false,
                        lineStyle: {
                            color: '#2B80CF',
                        }
                    },

                    data: categorys
                }
            ],
            series: [
                {
                    name: '一孩率',
                    type: 'bar',
                    stack: '总量',
                    itemStyle: {
                        normal: {
                            show: true,
                            color: '#277ace',
                            barBorderRadius: 0,
                            borderWidth: 0,
                            borderColor: '#333',
                        }
                    },
                    barGap: '0%',
                    barCategoryGap: '50%',
                    data: datas[0]
                },
                {
                    name: '二孩率',
                    type: 'bar',
                    stack: '总量',
                    itemStyle: {
                        normal: {
                            show: true,
                            color: '#5de3e1',
                            barBorderRadius: 0,
                            borderWidth: 0,
                            borderColor: '#333',
                        }
                    },
                    barGap: '0%',
                    barCategoryGap: '50%',
                    data: datas[1]
                },
                {
                    name: '多孩率',
                    type: 'bar',
                    stack: '总量',
                    itemStyle: {
                        normal: {
                            show: true,
                            color: '#00FFE6',
                            barBorderRadius: 0,
                            borderWidth: 0,
                            borderColor: '#333',
                        }
                    },
                    barGap: '0%',
                    barCategoryGap: '50%',
                    data: datas[2]
                }
            ]
        };

        $.getJSON("datas/gz_wjw_gqxjsjhsyqk.json", function (result) {
            // 基于准备好的dom，初始化echarts实例
            $.each(result, function (i, val) {
                categorys.push(val.QX);
                datas[0].push(parseFloat(val.YHL));
                datas[1].push(parseFloat(val.EHL));
                datas[2].push(parseFloat(val.DHL));
            });

            var myChart = echarts.init(document.getElementById('vpc17ccmychartbox1'));
            myChart.setOption(option);
        });



    }
    // 返回
    return chartcsjs;
})();